using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace Dojo {
    public class UrlResolver {
        public IList<ResolvedUrl> Resolve(string s) {
            s = s.Replace(" ", "");
            Regex pattern = new Regex(@"Dojo.require\(""(?<url>[a-z.*]+)""\)",RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
            IList<ResolvedUrl> result = new List<ResolvedUrl>();
            if (pattern.Matches(s).Count > 0) {
                foreach (Match match in pattern.Matches(s)) {
                    result.Add(new ResolvedUrl(match.Result("${url}")));
                }
            }
            return result;
        }
    }
}